#coding=utf-8

import env, db, gui
import utility as u
import settings as s

store = u.get_store()
env.store = store

if db.is_empty():
    sql = open('create_db.sql').read()
    store.execute(sql)
    #ps.sendMessage("db.NoUser")
    db.create_user(store, name=c, \
                   password=s.default_user_password)

user = db.get_user(store, name=s.default_user_password)
env.user = user

camp = store.find(Campaign, Campaign.user_id==User.id, User.name==u'jay').\
                  order_by(Desc(Campaign.last_modified_at)).first()
if camp:env.camp = camp
